//
//  MyBidCellViewModel.swift
//  cxd4iphone
//
//  Created by hexy on 12/15/15.
//  Copyright © 2015 hexy. All rights reserved.
//

import UIKit

typealias RepayPlanBtnClickBlock = (vm: MyInvestCellViewModel!)-> Void
typealias LoanPactBtnClickBlock = (vm: MyInvestCellViewModel!)-> Void

let MyInvestCellReuseID = "MyInvestCellReuseID"

class MyInvestCellViewModel: BaseCellViewModel {

    override var reuseId: String {
        
        return MyInvestCellReuseID
    }
        
    var bidModel: BidModel
    
    
    var repayPlanBtnClickBlock: RepayPlanBtnClickBlock?
    
    func aSetRepayPlanBtnClickBlock(block: RepayPlanBtnClickBlock) {
        
        repayPlanBtnClickBlock = block
    }
    
    var loanPactBtnClickBlock: LoanPactBtnClickBlock?
    
    func aSetloanPactBtnClickBlock(block: LoanPactBtnClickBlock) {
        
        loanPactBtnClickBlock = block
    }
    
    var statusImage: UIImage {
        
        guard let status = bidModel.status else {
            
            return UIImage()
        }
        
        switch status {
            
            case "complete":
                return UIImage(named: "me_repayed")!
            
            case "repaying":
                return UIImage(named: "me_repaying")!
            
            default:
                return UIImage()
        }
    }
    
    var repayLabelText: String {
        
        return ("complete" == bidModel.status!) ? "回收金额 :" : "下期还款额(元) :"
    }
    
    var profitLabelText: String {
        
         return ("complete" == bidModel.status!) ? "已赚金额 :" : "待收本息(元) :"
    }
    init(bidModel: BidModel) {
        
        self.bidModel = bidModel
        
        super.init(icon: nil, title: nil, detail: nil, destVC: nil)
    }
}
